<?php

//Default
class Form_User_Create extends Base_Form
{
    public function init()
    {
		$this->addElements(array(
			//
            new Zend_Form_Element_Text('name', array(
                'required'   => true,
                'label'		=> 'Name:',
                'filters'    => array('StringTrim'),
                'validators' => array(
					array('validator' => 'StringLength', 'options' => array(5,16))
                )
            )),
			//
            new Zend_Form_Element_Text('mail', array(
                'required'   => false,
                'label'      => 'Mail:',
                'filters'    => array('StringTrim'),
                'validators' => array(
					array('validator' => 'EmailAddress')
                ),
            )),
			//
            new Zend_Form_Element_radio('role', array(
                'label'        => 'Role:',
                'value'        => 'member',
                'multiOptions' => array(
					'member' =>  'member',
					'editor' =>  'editor',
					'master' =>  'master',
				),
                'required'     => true,
                'filters'      => array('StringTrim'),
                'validators'   => array(
                    array('InArray', false, array(array(
						'member', 'editor', 'master'
						)
					))
                ),
            )),
			//
            new Zend_Form_Element_Password('pass', array(
                'required'   => true,
                'label'      => 'New password:',
                'filters'    => array('StringTrim'),
				'description'=> 'Not modify for empty',
                'validators' => array(
					array('validator' => 'StringLength', 'options' => array(6,16))
                )
            )),
            //
            new Zend_Form_Element_radio('state', array(
                'label'        => 'State:',
                'value'        => '1',
                'multiOptions' => array(
					'1'  =>  'Actived',
					'0'   =>  'Inactive',
				),
                'required'		=> true,
                'separator'		=> '',
                'filters'		=> array('StringTrim'),
                'validators'	=> array(
                    array('InArray', false, array(array(
							'1', '0',
						)
					))
                ),
            )),
        ));

        $this->addDisplayGroup(
            array('name', 'pass', 'role', 'mail', 'state'), 'user',
			array(
				'legend' => 'Passport'
			)
		);
    }
}